<?php
namespace app\admin\controller;
use think\Db;

class Jifenflow extends Base
{
    public function index() {
        if(request()->isAjax ()){
            extract (input ());
            $map = [];
            if (isset($user_username) && $user_username != "") {
                $map['u.user_username'] = $user_username;
            }
            $page = input('page') ? input('page') : 1;
            $limit = input('limit') ? input("limit") : 10;// 获取总条数;
            $count = Db::name('jifen_flow jf')
                ->join('u_user u','u.user_id = jf.flow_user_id','left')
                ->where($map)
                ->count();
            $lists = Db::name('jifen_flow jf')
                ->join('u_user u','u.user_id = jf.flow_user_id','left')
                ->where($map)
                ->page($page, $limit)
                ->order('flow_add_time desc')
                ->select ();
            if(!empty($lists)){
            }
            return json(['code'=>220,'msg'=>'','count'=>$count,'data'=>$lists]);
        }
        return $this->fetch ('jifenflow/index');
    }
}

?>